# 在终端打印彩色字符
def get_color(str, color):
    color_dic = {
        'RED': '\033[1;31;42m',
        'GREEN': '\033[22;32;41m',
        'NORMAL': '\033[8;0m'
    }
    color_text = color.upper()
    print('color_text', color_text)
    if color in color_dic.keys():
        return '%s %s %s' % (color_dic[color_text], str, color_dic['NORMAL'])
    else:
        return '%s %s %s' % (color_dic['NORMAL'], str, color_dic['NORMAL'])


if __name__ == '__main__':
    print(get_color('我是红色的', 'RED'))
    print(get_color('我是红色的', 'GREEN'))
    print(get_color('我是红色的', 'BLACK'))
